#!/usr/bin/env bash
# vim:  fdm=marker fmr=[[[,]]] cms=\ #%s

bin_path=$(dirname $0)
if [ ${bin_path:0:1} != '/' ]
then
    bin_path=$(pwd)/$bin_path
fi
CLIENT=$bin_path/../../tool/snclient
ADDR=localhost:10050

LOG()
{ #[[[
    $CLIENT $ADDR LOG "hello world!"
} #]]]

main()
{ #[[[
    if [[ ! -x $CLIENT ]]
    then
        echo "client not found"
        return 1
    fi

    local option
    read -p "\
Services:
    1) LOG
Input: " option
    if [[ -z $option ]]
    then
        echo  "Error: option invalid"
        return 1
    fi
    case $option in
    1) LOG ;;
    *)
        echo "Error: option($option) not supported"
        return 1
        ;;
    esac
} #]]]

main
exit $?
